import 'package:xinxuan/vo/common_vo/common_costs_vo.dart';
import 'package:xinxuan/vo/common_vo/common_seckill_products_vo.dart';

class SeckillOrderDetailVo {

  SeckillOrderDetailData? data;

  SeckillOrderDetailVo({this.data});

  SeckillOrderDetailVo.fromJson(Map<String, dynamic> json) {
    data = json['data'] != null ? new SeckillOrderDetailData.fromJson(json['data']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.data != null) {
      data['data'] = this.data!.toJson();
    }
    return data;
  }
}

class SeckillOrderDetailData {
  int? id;
  String? orderSn;
  double? commissionRate;
  int? payStatus;
  int? teamId;
  int? userId;
  int? status;
  String? statusStr;
  int? source;
  String? payableAmount;
  String? paidAmount;
  String? totalAmount;
  String? createdAt;
  String? updatedAt;
  int? remainingTime;
  List<CommonSeckillProductsVo>? products;
  SeckillOrderAddress? address;
  List<CommonCostsVo>? costs;

  SeckillOrderDetailData(
      {this.id,
      this.orderSn,
      this.commissionRate,
      this.payStatus,
      this.teamId,
      this.userId,
      this.status,
      this.statusStr,
      this.source,
      this.payableAmount,
      this.paidAmount,
      this.totalAmount,
      this.createdAt,
      this.updatedAt,
      this.remainingTime,
      this.products,
      this.address,
      this.costs});

  SeckillOrderDetailData.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    orderSn = json['order_sn'];
    commissionRate = json['commission_rate'];
    payStatus = json['pay_status'];
    teamId = json['team_id'];
    userId = json['user_id'];
    status = json['status'];
    statusStr = json['status_str'];
    source = json['source'];
    payableAmount = json['payable_amount'];
    paidAmount = json['paid_amount'];
    totalAmount = json['total_amount'];
    createdAt = json['created_at'];
    updatedAt = json['updated_at'];
    remainingTime = json['remaining_time'];
    if (json['products'] != null) {
      products = <CommonSeckillProductsVo>[];
      json['products'].forEach((v) {
        products!.add(new CommonSeckillProductsVo.fromJson(v));
      });
    }
    if (json['address'] is List) {
      address = null;
    } else {
      address = json['address'] != null ? new SeckillOrderAddress.fromJson(json['address']) : null;
    }
    if (json['costs'] != null) {
      costs = <CommonCostsVo>[];
      json['costs'].forEach((v) {
        costs!.add(new CommonCostsVo.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['order_sn'] = this.orderSn;
    data['commission_rate'] = this.commissionRate;
    data['pay_status'] = this.payStatus;
    data['team_id'] = this.teamId;
    data['user_id'] = this.userId;
    data['status'] = this.status;
    data['status_str'] = this.statusStr;
    data['source'] = this.source;
    data['payable_amount'] = this.payableAmount;
    data['paid_amount'] = this.paidAmount;
    data['total_amount'] = this.totalAmount;
    data['created_at'] = this.createdAt;
    data['updated_at'] = this.updatedAt;
    data['remaining_time'] = this.remainingTime;
    if (this.products != null) {
      data['products'] = this.products!.map((v) => v.toJson()).toList();
    }
    if (this.address != null) {
      data['address'] = this.address!.toJson();
    }
    if (this.costs != null) {
      data['costs'] = this.costs!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class SeckillOrderAddress {
  int? addressId;
  String? consignee;
  String? mobile;
  int? province;
  int? city;
  int? district;
  String? provinceStr;
  String? cityStr;
  String? districtStr;
  String? address;

  SeckillOrderAddress(
      {this.addressId,
      this.consignee,
      this.mobile,
      this.province,
      this.city,
      this.district,
      this.provinceStr,
      this.cityStr,
      this.districtStr,
      this.address});

  SeckillOrderAddress.fromJson(Map<String, dynamic> json) {
    addressId = json['address_id'];
    consignee = json['consignee'];
    mobile = json['mobile'];
    province = json['province'];
    city = json['city'];
    district = json['district'];
    provinceStr = json['province_str'];
    cityStr = json['city_str'];
    districtStr = json['district_str'];
    address = json['address'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['address_id'] = this.addressId;
    data['consignee'] = this.consignee;
    data['mobile'] = this.mobile;
    data['province'] = this.province;
    data['city'] = this.city;
    data['district'] = this.district;
    data['province_str'] = this.provinceStr;
    data['city_str'] = this.cityStr;
    data['district_str'] = this.districtStr;
    data['address'] = this.address;
    return data;
  }
}

